package com.mingqijia.gassafety.db.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mingqijia.gassafety.db.entity.CmStatDevicealarm;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
@DS("db7")
public interface CmStatDevicealarmMapper extends BaseMapper<CmStatDevicealarm> {
    void insertBatch(@Param("datas") List<CmStatDevicealarm> datas);

    /**
     * 根据spid批量查询平台设备
     * @param spIds
     * @return
     */
    List<CmStatDevicealarm> queryPlatformImeiBySpId(@Param("spIds") List<String> spIds);


    /**
     * 获取指定条件的最后一条更新记录
     * @param spId
     * @param esCode
     * @param deviceType
     * @return
     */
    List<CmStatDevicealarm> selectLastStatDeviceAlarmStatus(@Param("spId") String spId,
                                                  @Param("esCode") String esCode,
                                                  @Param("deviceType") String deviceType);
}
